package com.ndp.fb.enums.targetingspec;

import lombok.Data;
import lombok.Getter;

/**
 * Created by Sisi on 14-11-18.
 */
@Getter
public enum PageType {

    //移动动态消息
    mobilefeed(0, "mobilefeed", "WALLE_MOBILE_NEWS_FEED",14),

    //
    mobileexternal(1, "mobileexternal", "WALLE_AUDIENCE_NETWORK",16),

    //inst
    instagramstream(2, "instagramstream", "WALLE_INSTAGRAM",17),

    //桌面动态消息
    desktopfeed(3, "desktopfeed", "WALLE_DESKTOP_FEED",13),

    //右边栏
    rightcolumn(4, "rightcolumn", "RIGHT_COLUMN",15);

    private int code;

    private String pageTypeName;

    private String showPageTypeName;
    private int materialCatoryId;
     PageType(int code, String pageTypeName, String showPageTypeName,int materialCatoryId) {
        this.code = code;
        this.pageTypeName = pageTypeName;
        this.showPageTypeName = showPageTypeName;
        this.materialCatoryId = materialCatoryId;
    }

    /**
     * 根据code获取WirelessCarrier
     *
     * @param code code
     * @return WirelessCarrier
     */
    public static PageType getPageType(int code) {
        for (PageType c : PageType.values()) {
            if (c.code == code) {
                return c;
            }
        }
        return null;
    }

    /**
     * 根据pageTypeName获取PageType
     *
     * @param pageTypeName pageTypeName
     * @return PageType
     */
    public static PageType getPageType(String pageTypeName) {
        for (PageType c : PageType.values()) {
            if (c.pageTypeName.equals(pageTypeName) ) {
                return c;
            }
        }
        return null;
    }


    /**
     * dpa 自动投放版位测试顺序
     * @return
     */
    public static PageType [] getAutoDpaPage(){
        PageType [] dpapage=new PageType[3];
        dpapage[0]=mobilefeed;
        dpapage[1]=desktopfeed;
        dpapage[2]=rightcolumn;
        return  dpapage;
    }
}
